/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.google.cse.emea.universaltransformer.transformers;

import com.google.cse.emea.jct.utils.Profile;
import javax.swing.JPanel;

/**
 *
 * @author jtrapp
 */
public interface TransformerModule {
    /**
     * Transformer Mode as specified in the configuration file
     * @return Transformer Mode
     */
    public String getName();
    
    /** 
     * Parse will be called everytime the input filename changes.
     * It can be used for analysing the file. In case of the XSLT Module
     * it will be used to parse the document and generate the dom tree.
     * 
     * @param filename Input Filename
     * @return true, if the file format is correct and the conversion can be performed.
     */
    public boolean parse(String filename);
    
    /**
     * Do the transformation on the previously parsed input file {@see parse}
     * @param outputFilename Where to write the trasformed content
     * @param values Parameters that shall be passed to the transformer.
     * @return true, if the tranformation has been succesfully performed.
     */
    public boolean transform(String outputFilename, java.util.AbstractMap<String, String> values);
    
    /**
     * To be able to add specific input widgets, each transformer can provide
     * some controls in this input panels. The transformer is responsible for
     * reading the values from this panel. 
     * @return A JPanel containing widgets for additional input.
     */
    public JPanel getInputPanel();
    
    /**
     * to be able to add specific output widgets, each transformer can provide
     * some controls. The transformer is responsible for acting on events triggered
     * from these widgets.
     * @return A JPanel containing widgets for controling the output.
     */
    public JPanel getOutputPanel();
    
    /**
     * The profile provides the data (model) that controls the behaviour of the 
     * controlers. The profile will automatically be stored as user preferences,
     * so after a restart all settings are the same.
     * @param profile The configuration
     */
    public void setProfile(Profile profile);
    
}
